/**
 * Advanced Software Engineering (Monica Farrow)
 * ParcelController class
 * 
 * Some of the methods in this class have been based on lecture notes provided by
 * Monica Farrow as a part of Software Engineering courses at Heriot-Watt University.
 */

package depotControllers;

import depotModels.ParcelUncollected;
import depotViews.ParcelGUI;

/**
 * ParcelController class - controls the ParcelUncollected model
 * @author Ionut Iordache, Nikky Afunugo, Dave Bond
 */
public class ParcelController implements Runnable {

	private ParcelGUI view; // allows controller to respond to ActionEvents in GUI
	private ParcelUncollected model;   // stores uncollected parcels

	/**
	 * constructor for ParcelController
	 * registers model and view
	 * @param view    the ParcelGUI object
	 * @param model   the ParcelUncollected object
	 */
	public ParcelController(ParcelGUI view, ParcelUncollected model) {
		this.model = model;
		this.view = view;

	}

	/**
	 * run method - does all the work
	 * oversees the population of uncollectedParcels
	 */
	public void run() {

		// initialise uncollectedParcels with some parcels (already in depot)
		model.processInputFile("parcels.csv");

		// add some randomly generated parcels
		model.addRandomParcels();

		// indicate parcel processing finished
		model.setPclFinishedFlag();

	}


}
